package com.heima.wemedia.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heima.model.admin.dtos.NewsAuthDto;
import com.heima.model.media.dtos.WmNewsResultDTO;
import com.heima.wemedia.entity.WmNews;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 自媒体图文内容信息表 Mapper 接口
 * </p>
 *
 * @author heima
 * @since 2021-03-16
 */
public interface WmNewsMapper extends BaseMapper<WmNews> {
    @Select("<script>" +
            "select a.*,b.name as authorName from wm_news a,wm_user b where a.wm_user_id=b.id " +
            "<if test=\"dto.title!=null and dto.title!='' \"> and a.title like concat('%',#{dto.title},'%') </if>" +
            "</script>")
    IPage<WmNewsResultDTO> slectWmNewsByPage(Page<WmNews> page,@Param("dto") NewsAuthDto dto);
}
